﻿#region

using YouTubePlaylist.Libraries;
using YouTubePlaylist.MusicVideoService;

#endregion

namespace YouTubePlaylist.Views
{
    public partial class MailLinkInputCtrl
    {
        private readonly string _link;

        public MailLinkInputCtrl(User u, VideoPlaylist p, VideoTrack t)
        {
            InitializeComponent();

            From.Text = u.ExternalKey;
            if (t == null)
            {
                Title.Text = "Email this playlist to a friend.";
                Subject.Text = string.Format("A message from VideoBaller.com: {0}", p.Name);
            }
            else
            {
                Title.Text = "Email this track to a friend.";
                Subject.Text = string.Format("A message from VideoBaller.com: {0} by {1}", t.Name, t.Artist);
            }
            _link = MailClient.GetLink(p, t);
        }

        public string Body
        {
            get { return RawBody.Text + "\n\nLink: " + _link; }
        }
    }
}